home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / amisl090.zip / FINDTSRS.C < prev    next >
C/C++ Source or Header  |  1992-09-12  |  1KB  |  49 lines

  1. /************************************************************************/
  2. /*                                    */
  3. /* FINDTSRS.C    Find all TSRs with signatures matching a given name    */
  4. /* Public Domain 1992 Ralf Brown                    */
  5. /* Version 0.90                             */
  6. /* Last Edit: 9/12/92                            */
  7. /*                                                                      */
  8. /* Must be compiled in a large data model (compact recommended)        */
  9. /* ex.    TCC -mc -c FINDTSRS.C                        */
  10. /*                                    */
  11. /************************************************************************/
  12.  
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <string.h>
  16. #include <dos.h>
  17.  
  18. /************************************************************************/
  19.  
  20. int find_TSRs(char *mpx_numbers,char *manuf,char *name)
  21. {
  22.    int found = 0 ;
  23.    int mpx, len1, len2 ;
  24.    char far *sig ;
  25.    union REGS regs ;
  26.    
  27.    /**/
  28.    /* loop through all 256 multiplex numbers, remembering each match we find */
  29.    /**/
  30.    for (mpx = 0 ; mpx <= 255 ; mpx++)
  31.       {
  32.       regs.h.ah = mpx ;
  33.       regs.h.al = 0 ;  /* installation check */
  34.       int86(0x2D,®s,®s) ;
  35.       if (regs.h.al == 0xFF) /* installed? */
  36.      {
  37.      sig = MK_FP(regs.x.dx,regs.x.di) ;
  38.      if (manuf)
  39.         len1 = min(strlen(manuf),8) ;
  40.      len2 = min(strlen(name),8) ;
  41.      if ((manuf == NULL || (strnicmp(manuf,sig,len1) == 0)) &&
  42.          strnicmp(name,sig+8,len2) == 0)
  43.         mpx_numbers[found++] = mpx ;
  44.      }
  45.       }
  46.    return found ;
  47. }
  48.  
  49.